<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>超市小票</title>
	</head>
	<body>
		<script>
			var txuPrice=245;
			var txuCount=2;
			var shoePrice=570;
			var shoeCount=10;
			var paiPrice=320;
			var paiCount=1;
			
			var discount=0.8;
			var userMoney=5300;
			var totalMoney=(txuPrice*txuCount+shoePrice*shoeCount+paiPrice*paiCount)*discount
			
			document.write("<table width='300' > ");
			document.write("<tr align='center'>");
			document.write("<td colspan='4'>");
			document.write("********消费单********");
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>");
			document.write("购买物品");
			document.write("</td>");
			document.write("<td>");
			document.write("单价");
			document.write("</td>");
			document.write("<td>");
			document.write("数量");
			document.write("</td>");
			document.write("<td>");
			document.write("金额");
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td>");
			document.write("T恤");
			document.write("</td>");
			document.write("<td>");
			document.write("&yen;"+txuPrice);
			document.write("</td>");
			document.write("<td>");
			document.write(txuCount);
			document.write("</td>");
			document.write("<td>");
			document.write("&yen;"+txuPrice*txuCount);
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr >");
			document.write("<td>");
			document.write("网球鞋");
			document.write("</td>");
			document.write("<td>");
			document.write("&yen;"+shoePrice);
			document.write("</td>");
			document.write("<td>");
			document.write(shoeCount);
			document.write("</td>");
			document.write("<td>");
			document.write("&yen;"+shoePrice*shoeCount);
			document.write("</td>");
			document.write("</tr>");
						
			document.write("<tr>");
			document.write("<td>");
			document.write("网球拍");
			document.write("</td>");
			document.write("<td>");
			document.write("&yen;"+paiPrice);
			document.write("</td>");
			document.write("<td>");
			document.write(paiCount);
			document.write("</td>");
			document.write("<td>");
			document.write("&yen;"+paiPrice*paiCount);
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td colspan='4'>");
			document.write("&nbsp;");
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td colspan='1'>");
			document.write("折扣");
			document.write("</td>");
			document.write("<td colspan='3'>");
			document.write(discount*10+"折");
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td colspan='1'>");
			document.write("消费总金额");
			document.write("</td>");
			document.write("<td colspan='3'>");
			document.write(totalMoney);
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td colspan='1'>");
			document.write("实际消费");
			document.write("</td>");
			document.write("<td colspan='3'>");
			document.write(userMoney);
			document.write("</td>");
			document.write("</tr>");
			
			document.write("<tr>");
			document.write("<td colspan='1'>");
			document.write("找零");
			document.write("</td>");
			document.write("<td colspan='3'>");
			document.write(userMoney-totalMoney);
			document.write("</td>");
			document.write("</tr>");
			
			document.write("</table>");
		</script>
	</body>
</html>
